home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / System 7.0 Samples / ProcDoggie 1.0a6 / UGlobals.p < prev    next >
Encoding:
Text File  |  1991-02-07  |  8.0 KB  |  215 lines  |  [TEXT/MPS ]

  1. UNIT UGlobals;
  2.  
  3.  
  4. {-------------------------------------------------------------------------------
  5. #
  6. #    Apple Macintosh Developer Technical Support
  7. #
  8. #    Interfaces for the application utilities
  9. #
  10. #    Program:    ProcDoggie
  11. #    File:        UGlobals.p - Pascal Implementation
  12. #
  13. #    by:        Forrest Tanaka
  14. #
  15. #    Copyright © 1988-1991 Apple Computer, Inc.
  16. #    All rights reserved.
  17. #
  18. --------------------------------------------------------------------------------
  19. #
  20. # This unit contains declarations and routines that didn’t seem to fit into any
  21. # other unit in this application.
  22. #
  23. -------------------------------------------------------------------------------}
  24.  
  25.  
  26. INTERFACE
  27.  
  28.  
  29. (*******************************************************************************
  30. * Used Units
  31. *******************************************************************************)
  32.  
  33.     USES
  34.         (* Group 1 *)
  35.          Types
  36.         ,QuickDraw
  37.  
  38.         (* Group 2 *)
  39.         ,Controls
  40.         ,Errors
  41.         ,Events
  42.         ,Files
  43.         ,GestaltEqu
  44.         ,Memory
  45.         ,Resources
  46.         ,TextEdit
  47.         ,ToolUtils
  48.  
  49.         (* Group 3 *)
  50.         ,Notification
  51.         ,OSEvents
  52.         ,Processes
  53.         ,Windows
  54.  
  55.         (* Group 4 *)
  56.         ,Dialogs
  57.  
  58.         (* Application *)
  59.         ,UEmergMem
  60.         ;
  61.  
  62.  
  63. (*******************************************************************************
  64. * Constants
  65. *******************************************************************************)
  66.  
  67.     CONST
  68.         rMemErrMessages        = 1000; {Resource ID of memory error message STR#}
  69.         kMemErrAppOpenMsg      = 1;    {Not enough memory to open application}
  70.         kMemErrProcListOpenMsg = 2;    {Not enough mem to open process list wind}
  71.         kMemErrLowMemWarnMsg   = 3;    {Free memory is low; proceed with caution}
  72.         kMemErrProcInfoOpenMsg = 4;    {Not enough mem to open process info wind}
  73.  
  74.         rResErrMessages     = 1001; {Resource ID of resource error message STR#}
  75.         kResErrAppDamageMsg = 1;    {Application is damaged}
  76.  
  77.         rMiscErrMessages   = 1002; {Resource ID of misc. error message STR#}
  78.         kMiscErrUnknownMsg = 1;    {Unknown error}
  79.  
  80.         rMiscWrnMessages     = 2000; {Resource ID of misc. warning message STR#}
  81.         kMiscWrnUncleanMsg   = 1;    {Application not 32-bit clean warning}
  82.         kMiscWrnLaunchMemMsg = 2;    {Not enough memory to launch}
  83.  
  84.         kMaxSleepTime = 60; {Max WNE sleep time in ticks, 1 second in this case}
  85.  
  86.  
  87. (*******************************************************************************
  88. * Global Variables
  89. *******************************************************************************)
  90.  
  91.     VAR
  92.         gError:        Integer; {Generic application error code}
  93.         gWereInFront:  Boolean; {TRUE if this appliation is front most}
  94.         gQuitting:     Boolean; {TRUE if user chose Quit command}
  95.  
  96.  
  97. (*******************************************************************************
  98. * DoQuit - Handle Quit command
  99. *
  100. * This routine is called when this application should quit.  It’s called
  101. * when the user chooses the Quit command from the file menu or when a 'quit'
  102. * AppleEvent is received.
  103. *******************************************************************************)
  104.  
  105.     PROCEDURE DoQuit;
  106.  
  107.  
  108. (*******************************************************************************
  109. * ShowStopAlert - Show a stop alert
  110. *
  111. * This routine puts up a standard stop alert with just an OK button and a
  112. * specified message.  messageClass specifies the STR# resource ID which contains
  113. * the message to display and messageIndex specifies the index (the first message
  114. * is index 1) into that STR# of the message to display.
  115. *******************************************************************************)
  116.  
  117.     FUNCTION ShowStopAlert (messageClass: Integer;
  118.                             messageIndex: Integer): Integer;
  119.  
  120.  
  121. (*******************************************************************************
  122. * ShowCautionOKCancelAlert - Show a caution alert with an OK and Cancel button
  123. *
  124. * This routine puts up a standard caution alert with just an OK button, a Cancel
  125. * button, and a specified message.  messageClass specifies the STR# resource ID
  126. * which contains the message to display and messageIndex specifies the index
  127. * (the first message is index 1) into that STR# of the message to display.
  128. *******************************************************************************)
  129.  
  130.     FUNCTION ShowCautionOKCancelAlert (messageClass: Integer;
  131.                                        messageIndex: Integer): Integer;
  132.  
  133.  
  134. (*******************************************************************************
  135. * ShowCautionOKAlert - Show a caution alert with just an OK button
  136. *
  137. * This routine puts up a standard caution alert with just an OK button and a
  138. * specified message.  messageClass specifies the STR# resource ID which contains
  139. * the message to display and messageIndex specifies the index (the first message
  140. * is index 1) into that STR# of the message to display.
  141. *******************************************************************************)
  142.  
  143.     FUNCTION ShowCautionOKAlert (messageClass: Integer;
  144.                                  messageIndex: Integer): Integer;
  145.  
  146.  
  147. (*******************************************************************************
  148. * ShowAboutBox - Show the About box
  149. *
  150. * The About box for this application is displayed.  This is just a simple alert
  151. * box with an OK button.  The name of this application is displayed as is its
  152. * version number.
  153. *******************************************************************************)
  154.  
  155.     PROCEDURE ShowAboutBox;
  156.  
  157.  
  158. (*******************************************************************************
  159. * CreateWindow - Create a window
  160. *
  161. * This routine creates a window using the WIND resource template with a resource
  162. * ID of windowTmplID in front of all existing windows.  A pointer to this window
  163. * is returned.  If we’re running on a Color QuickDraw machine, the window is
  164. * created as a color window.  This window must be disposed of by calling
  165. * CloseWindow followed by DisposPtr on the window’s WindowRecord.  The window
  166. * shouldn’t be closed using DisposeWindow.  When this routine returns, the new
  167. * window is the current GrafPort.
  168. *
  169. * The window isn’t explicitly repositioned from its position as defined by the
  170. * resource definition.  Instead, I use the window-positioning utilities.  This
  171. * isn’t documented at this time and it isn’t even certain the these utilities
  172. * will be implemented in the final release of system software 7.0.  Use ResEdit
  173. * 2.1’s WIND editor to control the window-positioning utilities.
  174. *
  175. * If there isn’t enough memory for the window, then gError global is set to
  176. * memFullErr.  If the WIND resource couldn’t be loaded, gError is set to
  177. * resNotFound.  If anything else went wrong while creating the window, then
  178. * gError is set to dsSysErr.
  179. *******************************************************************************)
  180.  
  181.     FUNCTION CreateWindow (windowTmplID: Integer): WindowPtr;
  182.  
  183.  
  184. (*******************************************************************************
  185. * CreateDialog - Create a dialog window
  186. *
  187. * This routine creates a dialog window using the WIND resource template with a
  188. * resource ID of windowTmplID in front of all existing windows.  A pointer to
  189. * this window is returned.  If we’re running on a Color QuickDraw machine, the
  190. * window is created as a color window.  This window must be disposed of by
  191. * calling CloseWindow followed by DisposPtr on the window’s DialogRecord.  The
  192. * window shouldn’t be closed using DisposeWindow.  When this routine returns,
  193. * the new dialog is the current GrafPort.
  194. *
  195. * The window isn’t explicitly repositioned from its position as defined by the
  196. * resource definition.  Instead, I use the window-positioning utilities.  This
  197. * isn’t documented at this time and it isn’t even certain the these utilities
  198. * will be implemented in the final release of system software 7.0.  Use ResEdit
  199. * 2.1’s WIND editor to control the window-positioning utilities.
  200. *
  201. * If there isn’t enough memory for the window, then gError global is set to
  202. * memFullErr.  If the WIND resource couldn’t be loaded, gError is set to
  203. * resNotFound.  If anything else went wrong while creating the window, then
  204. * gError is set to dsSysErr.
  205. *******************************************************************************)
  206.  
  207.     FUNCTION CreateDialog (dialogTmplID: Integer): DialogPtr;
  208.  
  209.  
  210. IMPLEMENTATION
  211.  
  212.     {$I UGlobals.inc1.p}
  213.  
  214. END.
  215.